const connection = require("../app/database")

class AuthService {
  async checkPermission(tableName,id,userId){
    try {
      const statement = `SELECT * FROM ${tableName} where id = ? && user_id = ?`
      const [result] = await connection.promise().execute(statement,[id,userId])
      return result
    } catch (error) {
      console.log(error);
      throw new Error(error)
    }
  }
}

module.exports = new AuthService();